package de.urlaub.server.data;

import java.io.Serializable;

import javax.interceptor.Interceptors;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import de.urlaub.server.logging.LoggingInterceptor;

@Entity
@Table(name="Employee")
@Interceptors(LoggingInterceptor.class)
public class Employee implements Serializable {

	private static final long serialVersionUID = 670058471525778042L;
	@Id
	@Column(nullable=false)
	private String employeeId;
	@Column(nullable=false)
	private String firstName;
	@Column(nullable=false)
	private String lastName;
	@Column(nullable=false)
	private String password;
	@Column(nullable=false)
	private String mail;
	@ManyToOne(cascade = CascadeType.ALL)
	@JoinColumn(name = "divisionId")
	private Division division;
	
	public Employee (String employeeId,
					 String firstName,
					 String lastName,
					 String password,
					 String mail,
					 Division division)
	{
		this.employeeId = employeeId;
		this.firstName = firstName;
		this.lastName = lastName;
		this.password = password;
		this.mail = mail;
		this.division = division;
	}

	public String getEmployeeId() {
		return employeeId;
	}

	public void setEmployeeId(String employeeId) {
		this.employeeId = employeeId;
	}

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}
	
	public String getMail() {
		return mail;
	}
	
	public void setMail(String mail) {
		this.mail = mail;
	}

	public Division getDivision() {
		return division;
	}

	public void setDivision(Division division) {
		this.division = division;
	}

}
